import request from "@/utils/request";
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询方案列表
export function listPlan(query) {
  return request({
    url: "/system/plan/list",
    method: "get",
    params: query,
  });
}
// 查询方案列表-查询归属医院的和科室集合
export function listPlanDept(query) {
  return request({
    url: "/system/plan/list/dept",
    method: "get",
    params: query,
  });
}


// 查询方案详细
export function getPlan(planId) {
  return request({
    url: "/system/plan/" + parseStrEmpty(planId),
    method: "get",
  });
}
// 新增方案
export function addPlan(data) {
  return request({
    url: "/system/plan",
    method: "post",
    data: data,
  });
}
// 修改方案
export function updatePlan(data) {
  return request({
    url: "/system/plan",
    method: "put",
    data: data,
  });
}
// 删除方案
export function delPlan(planId) {
  return request({
    url: "/system/plan/" + planId,
    method: "delete",
  });
}

// 方案状态修改
export function changePlanStatus(planId, status) {
  const data = {
    planId,
    status,
  };
  return request({
    url: "/system/plan/changeStatus",
    method: "put",
    data: data,
  });
}


// 新增套餐
export function addMeal(data) {
  return request({
    url: "/system/meal",
    method: "post",
    data: data,
  });
}
// 查询套餐列表-查询归属医院的和科室集合
export function listMeal(query) {
  return request({
    url: "/system/meal/list",
    method: "get",
    params: query,
  });
}
// 查询套餐列表
export function listMealDept(query) {
  return request({
    url: "/system/meal/list/dept",
    method: "get",
    params: query,
  });
}
// 删除套餐方案
export function delMeal(setMealId) {
  return request({
    url: "/system/meal/" + setMealId,
    method: "delete",
  });
}
// 修改套餐方案
export function updateMeal(data) {
  return request({
    url: "/system/meal",
    method: "put",
    data: data,
  });
}
// 查询方案详细
export function getMeal(setMealId) {
  return request({
    url: "/system/meal/" + parseStrEmpty(setMealId),
    method: "get",
  });
}
// 套餐方案状态修改
export function changeMealStatus(setMealId, status) {
  const data = {
    setMealId,
    status,
  };
  return request({
    url: "/system/meal/changeStatus",
    method: "put",
    data: data,
  });
}

// 新增套餐所属方案
// export function addSysSetMeaplan(data) {
//   return request({
//     url: "/system/sysSetMeaplan",
//     method: "post",
//     data: data,
//   });
// }
export function addSysSetMeaplan(planId, setMealId) {
  return request({
    url: "/system/sysSetMeaplan/add/" + planId + "/" + setMealId,
    method: "get",

  });
}

// 删除套餐所属方案
export function delSysSetMeaplan(sPlanIds) {
  return request({
    url: "/system/sysSetMeaplan/" + sPlanIds,
    method: "delete",
  });
}
// 修改套餐所属方案
export function updateSysSetMeaplan(data) {
  return request({
    url: "/system/sysSetMeaplan",
    method: "put",
    data: data,
  });
}


//查询平台单项列表
export function listPlatformPlan(query) {
  return request({
    url: '/system/plan/platformList',
    method: 'get',
    params: query
  })
}

//复制平台单项
export function copyPlatformPlan(data, deptId, hospitalId) {
  return request({
    url: "/system/plan/copyPlatform/" + deptId + "/" + hospitalId + "/" + data,
    method: "get",
  });
}

